package com.chuangfeng.building.ms.menu.action;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.chuangfeng.building.common.CoreAction;
import com.chuangfeng.building.entity.TMsMenuInfo;
import com.chuangfeng.building.ms.menu.service.MsMenuMng;


@SuppressWarnings("serial")
@Scope("prototype")
@Controller("ms.msMenu")
public class MsMenuAction extends CoreAction<TMsMenuInfo,MsMenuMng>{
	
	private final Logger logger = Logger.getLogger(this.getClass());
	
	@Autowired
	private MsMenuMng msMenuMng;

	/**
	 * 得到所有根目录菜单--一级菜单
	 * @return
	 */
	public String getRoot(){
		logger.debug("得到所有根目录菜单--一级菜单");
		try{
			 List<TMsMenuInfo> rootMenu = msMenuMng.findAll();
			 request.setAttribute("rootMenu", rootMenu);
			 return "rootMenu";
		}catch(Exception e){
			logger.error(e.getMessage());
			return "error";//返回错误页面
		}
	}
	

}
